#include <stdio.h>
#include <string.h>
int main()
{
	int i = 0;
	scanf("%d", &i);
	getchar();
	char cal = 0;
	while (i--)
	{
		int num1 = 0;
		int num2 = 0;
		char ch[100] = { 0 };
		char ch2[100] = { 0 };
		fgets(ch, sizeof(ch), stdin);
		int x = strlen(ch);
		ch[x - 1] = 0;
		int count = 0;
		int j = 0;
		while (ch[j])
		{
			if (ch[j] == ' ')
				count++;
			j++;
		}
		if (count == 2)
			sscanf(ch, "%c %d %d", &cal, &num1, &num2);
		if (count == 1)
			sscanf(ch, "%d %d", &num1, &num2);
		if (cal == 'a')
			sprintf(ch2, "%d+%d=%d", num1, num2, num1 + num2);
		if (cal == 'b')
			sprintf(ch2, "%d-%d=%d", num1, num2, num1 - num2);
		if (cal == 'c')
			sprintf(ch2, "%d*%d=%d", num1, num2, num1 * num2);
		if (cal == 'd')
			sprintf(ch2, "%d/%d=%d", num1, num2, num1 / num2);
		printf("%s\n%zu\n", ch2, strlen(ch2));
	}
	return 0;
}
